<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" 
                      "http://www.w3.org/TR/html4/strict.dtd"> 
<html> 
  <head> 
    <title>Device Properties Example</title> 
 
    <script type="text/javascript" charset="utf-8" src="phonegap.js"></script> 
    <script type="text/javascript" charset="utf-8"> 
 
    // Wait for PhoneGap to load 
    // 
    function onLoad() { 
        document.addEventListener("deviceready", onDeviceReady, false); 
    } 
 
    // PhoneGap is ready 
    // 
    function onDeviceReady() { 
        navigator.geolocation.getCurrentPosition(onSuccess, onError); 
    } 
 
    // onSuccess Geolocation 
    // 
    function onSuccess(position) { 
        var element = document.getElementById('geolocation'); 
        element.innerHTML = 'Latitude: '           + position.coords.latitude              + '<br />' + 
                            'Longitude: '          + position.coords.longitude             + '<br />' + 
                            'Altitude: '           + position.coords.altitude              + '<br />' + 
                            'Accuracy: '           + position.coords.accuracy              + '<br />' + 
                            'Altitude Accuracy: '  + position.coords.altitudeAccuracy      + '<br />' + 
                            'Heading: '            + position.coords.heading               + '<br />' + 
                            'Speed: '              + position.coords.speed                 + '<br />' + 
                            'Timestamp: '          + new Date(position.timestamp)          + '<br />'; 
    } 
 
    // onError Callback receives a PositionError object 
    // 
    function onError(error) { 
        alert('code: '    + error.code    + '\n' + 
              'message: ' + error.message + '\n'); 
    } 
 
    </script> 
  </head> 
  <body onload="onLoad()"> 
    <p id="geolocation">Finding geolocation...</p> 
  </body> 
</html> 
